<template>
    <view
        @touchmove.stop.prevent="__e"
        :class="['uni-popup', 'data-v-b9981cd0', popupstyle, isDesktop ? 'fixforpc-z-index' : '']"
        :data-event-opts="[['touchmove', [['clear', ['$event']]]]]"
        v-if="showPopup"
    >
        <view @touchstart="__e" class="data-v-b9981cd0" :data-event-opts="[['touchstart', [['touchstart', ['$event']]]]]">
            <uni-transition
                @__l="__l($event, { eventOpts: [['^click', [['onTap']]]] })"
                @click="__e($event, { eventOpts: [['^click', [['onTap']]]] })"
                class="data-v-b9981cd0"
                :data-event-opts="[['^click', [['onTap']]]]"
                :duration="duration"
                modeClass="fade"
                name="mask"
                :show="showTrans"
                :styles="maskClass"
                vueId="0c37304b-1"
                v-if="maskShow"
            ></uni-transition>
            <uni-transition
                @__l="__l($event, { eventOpts: [['^click', [['onTap']]]] })"
                @click="__e($event, { eventOpts: [['^click', [['onTap']]]] })"
                class="data-v-b9981cd0"
                :data-event-opts="[['^click', [['onTap']]]]"
                :duration="duration"
                :modeClass="ani"
                name="content"
                :show="showTrans"
                :styles="transClass"
                vueId="0c37304b-2"
                :vueSlots="['default']"
            >
                <view
                    @tap="__e"
                    :class="['uni-popup__wrapper', 'data-v-b9981cd0', popupstyle]"
                    :data-event-opts="[['tap', [['clear', ['$event']]]]]"
                    :style="'background-color:' + bg + ';'"
                >
                    <slot></slot>
                </view>
            </uni-transition>
        </view>
    </view>
</template>

<script>
import uniTransition from '@/uni_modules/uni-transition/components/uni-transition/uni-transition';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['uni_modules/uni-popup/components/uni-popup/uni-popup'],
    {
        '0fa2': function (t, o, i) {
            'use strict';

            i.r(o);
            var n = i('6b6d');
            var e = i('d672');
            for (var s in e) {
                if (['default'].indexOf(s) < 0) {
                    (function (t) {
                        i.d(o, t, function () {
                            return e[t];
                        });
                    })(s);
                }
            }
            i('9550');
            var a = i('f0c5');
            var p = Object(a.a)(e.default, n.b, n.c, false, null, 'b9981cd0', null, false, n.a, void 0);
            o.default = p.exports;
        },
        '6b6d': function (t, o, i) {
            'use strict';

            i.d(o, 'b', function () {
                return e;
            });
            i.d(o, 'c', function () {
                return s;
            });
            i.d(o, 'a', function () {
                return n;
            });
            var n = {
                uniTransition: function () {
                    return Promise.all([i.e('common/vendor'), i.e('uni_modules/uni-transition/components/uni-transition/uni-transition')]).then(i.bind(null, '5e50'));
                }
            };
            var e = function () {
                this.$createElement;
                this._self._c;
            };
            var s = [];
        },
        9550: function (t, o, i) {
            'use strict';

            var n = i('d015');
            i.n(n).a;
        },
        c4f3: function (t, o, i) {
            'use strict';

            (function (t) {
                Object.defineProperty(o, '__esModule', {
                    value: true
                });
                o.default = void 0;
                var i = {
                    name: 'uniPopup',
                    components: {},
                    emits: ['change', 'maskClick'],
                    props: {
                        animation: {
                            type: Boolean,
                            default: true
                        },
                        type: {
                            type: String,
                            default: 'center'
                        },
                        maskClick: {
                            type: Boolean,
                            default: true
                        },
                        backgroundColor: {
                            type: String,
                            default: 'none'
                        },
                        safeArea: {
                            type: Boolean,
                            default: true
                        }
                    },
                    watch: {
                        type: {
                            handler: function (t) {
                                if (this.config[t]) {
                                    this[this.config[t]](true);
                                }
                            },
                            immediate: true
                        },
                        isDesktop: {
                            handler: function (t) {
                                if (this.config[t]) {
                                    this[this.config[this.type]](true);
                                }
                            },
                            immediate: true
                        },
                        maskClick: {
                            handler: function (t) {
                                this.mkclick = t;
                            },
                            immediate: true
                        }
                    },
                    data: function () {
                        return {
                            duration: 300,
                            ani: [],
                            showPopup: false,
                            showTrans: false,
                            popupWidth: 0,
                            popupHeight: 0,
                            config: {
                                top: 'top',
                                bottom: 'bottom',
                                center: 'center',
                                left: 'left',
                                right: 'right',
                                message: 'top',
                                dialog: 'center',
                                share: 'bottom'
                            },
                            maskClass: {
                                position: 'fixed',
                                bottom: 0,
                                top: 0,
                                left: 0,
                                right: 0,
                                backgroundColor: 'rgba(0, 0, 0, 0.4)'
                            },
                            transClass: {
                                position: 'fixed',
                                left: 0,
                                right: 0
                            },
                            maskShow: true,
                            mkclick: true,
                            popupstyle: this.isDesktop ? 'fixforpc-top' : 'top'
                        };
                    },
                    computed: {
                        isDesktop: function () {
                            return this.popupWidth >= 500 && this.popupHeight >= 500;
                        },
                        bg: function () {
                            return '' === this.backgroundColor || 'none' === this.backgroundColor ? 'transparent' : this.backgroundColor;
                        }
                    },
                    mounted: function () {
                        var that = this;
                        !(function () {
                            var i = t.getSystemInfoSync();
                            var n = i.windowWidth;
                            var e = i.windowHeight;
                            var s = i.windowTop;
                            var a = i.safeAreaInsets;
                            that.popupWidth = n;
                            that.popupHeight = e + s;
                            that.safeArea ? (that.safeAreaInsets = a) : (that.safeAreaInsets = 0);
                        })();
                    },
                    created: function () {
                        this.mkclick = this.maskClick;
                        this.animation ? (this.duration = 300) : (this.duration = 0);
                        this.messageChild = null;
                        this.clearPropagation = false;
                    },
                    methods: {
                        closeMask: function () {
                            this.maskShow = false;
                        },
                        disableMask: function () {
                            this.mkclick = false;
                        },
                        clear: function (t) {
                            t.stopPropagation();
                            this.clearPropagation = true;
                        },
                        open: function (t) {
                            (t && -1 !== ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share'].indexOf(t)) || (t = this.type);
                            this.config[t]
                                ? (this[this.config[t]](),
                                  this.$emit('change', {
                                      show: true,
                                      type: t
                                  }))
                                : console.error('缺少类型：', t);
                        },
                        close: function (t) {
                            var that = this;
                            this.showTrans = false;
                            this.$emit('change', {
                                show: false,
                                type: this.type
                            });
                            clearTimeout(this.timer);
                            this.timer = setTimeout(function () {
                                that.showPopup = false;
                            }, 300);
                        },
                        touchstart: function () {
                            this.clearPropagation = false;
                        },
                        onTap: function () {
                            this.clearPropagation ? (this.clearPropagation = false) : (this.$emit('maskClick'), this.mkclick && this.close());
                        },
                        top: function (t) {
                            var that = this;
                            this.popupstyle = this.isDesktop ? 'fixforpc-top' : 'top';
                            this.ani = ['slide-top'];
                            this.transClass = {
                                position: 'fixed',
                                left: 0,
                                right: 0,
                                backgroundColor: this.bg
                            };
                            t ||
                                ((this.showPopup = true),
                                (this.showTrans = true),
                                this.$nextTick(function () {
                                    if (that.messageChild && 'message' === that.type) {
                                        that.messageChild.timerClose();
                                    }
                                }));
                        },
                        bottom: function (t) {
                            this.popupstyle = 'bottom';
                            this.ani = ['slide-bottom'];
                            this.transClass = {
                                position: 'fixed',
                                left: 0,
                                right: 0,
                                bottom: 0,
                                paddingBottom: (this.safeAreaInsets && this.safeAreaInsets.bottom) || 0,
                                backgroundColor: this.bg
                            };
                            t || ((this.showPopup = true), (this.showTrans = true));
                        },
                        center: function (t) {
                            this.popupstyle = 'center';
                            this.ani = ['zoom-out', 'fade'];
                            this.transClass = {
                                position: 'fixed',
                                display: 'flex',
                                flexDirection: 'column',
                                bottom: 0,
                                left: 0,
                                right: 0,
                                top: 0,
                                justifyContent: 'center',
                                alignItems: 'center'
                            };
                            t || ((this.showPopup = true), (this.showTrans = true));
                        },
                        left: function (t) {
                            this.popupstyle = 'left';
                            this.ani = ['slide-left'];
                            this.transClass = {
                                position: 'fixed',
                                left: 0,
                                bottom: 0,
                                top: 0,
                                backgroundColor: this.bg,
                                display: 'flex',
                                flexDirection: 'column'
                            };
                            t || ((this.showPopup = true), (this.showTrans = true));
                        },
                        right: function (t) {
                            this.popupstyle = 'right';
                            this.ani = ['slide-right'];
                            this.transClass = {
                                position: 'fixed',
                                bottom: 0,
                                right: 0,
                                top: 0,
                                backgroundColor: this.bg,
                                display: 'flex',
                                flexDirection: 'column'
                            };
                            t || ((this.showPopup = true), (this.showTrans = true));
                        }
                    }
                };
                o.default = i;
            }.call(this, i('543d').default));
        },
        d015: function (t, o, i) {},
        d672: function (t, o, i) {
            'use strict';

            i.r(o);
            var n = i('c4f3');
            var e = i.n(n);
            for (var s in n) {
                if (['default'].indexOf(s) < 0) {
                    (function (t) {
                        i.d(o, t, function () {
                            return n[t];
                        });
                    })(s);
                }
            }
            o.default = e.a;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'uni_modules/uni-popup/components/uni-popup/uni-popup-create-component',
    {
        'uni_modules/uni-popup/components/uni-popup/uni-popup-create-component': function (t, o, i) {
            i('543d').createComponent(i('0fa2'));
        }
    },
    [['uni_modules/uni-popup/components/uni-popup/uni-popup-create-component']]
]);
</script>
<style>
@import './uni-popup.css';
</style>
